package com.aaa.sys.service.impl;

import com.aaa.sys.entity.Position;
import com.aaa.sys.mapper.PositionMapper;
import com.aaa.sys.service.PositionService;
import com.aaa.sys.vo.PositionVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 职位表 服务实现类
 * </p>
 *
 * @author ykq
 * @since 2020-12-03
 */
@Service
public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> implements PositionService {

    @Override
    public Page<Position> findAllByCondition(Integer current, Integer limit, PositionVo positionVo) {
        QueryWrapper<Position> wrapper=new QueryWrapper<>();
        String name = positionVo.getName();
        if(StringUtils.isNotEmpty(name)){
            wrapper.like("name",name);
        }
        Page<Position> page=new Page<>(current,limit);
        this.baseMapper.selectPage(page,wrapper);
        return page;
    }
}
